package org.bizon.dinner.gui.topcompoments;

import java.util.List;

import org.bizon.dinner.gui.dialogs.SecuritySystem;

import diiner.common.webaccess.DinnerService;
import diiner.common.webaccess.Eat;
import diiner.common.webaccess.UnAutorizationException_Exception;

public class DinnerController {
	private static DinnerController controller = new DinnerController();;

	static DinnerController getInstance() {
		return controller;
	}

	private DinnerController() {
	}

	public synchronized List<Eat> loadEat() {
		Long login = SecuritySystem.getID();
		try {
			return getDinnerService().getList(login);
		} catch (UnAutorizationException_Exception e) {
			SecuritySystem.showError(e);
			return null;
		}
	}

	public void logout() {

	}

	private DinnerService getDinnerService() {
		return SecuritySystem.getDinnerService();
	}
}
